package nl.virtualbookshelf.controller

import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.{RequestMethod, RequestMapping}
import org.springframework.web.servlet.ModelAndView
import org.springframework.beans.factory.annotation.Autowired
import nl.virtualbookshelf.dao.CsvBookDao
import reflect.BeanProperty

@Controller
class BookController {

  @Autowired
  @BeanProperty
  var bookDao:CsvBookDao = null

  @RequestMapping(value = Array("/books"), method = Array(RequestMethod.GET))
	def allBooks:ModelAndView = {
    new ModelAndView("index", "books", bookDao.parse("boeken.txt"))
  }
}